package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.UsersetMapper;
import com.huasan.www.demon.data.service.UsersetService;

import com.huasan.www.demon.pojo.Userset;
import com.huasan.www.demon.pojo.UsersetExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("usersetService")
public class UsersetServiceImpl implements UsersetService{
	
    @Autowired
    private UsersetMapper usersetDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int countByExample(UsersetExample example){
      return usersetDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByExample(UsersetExample example){
      return usersetDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return usersetDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insert(Userset record){
      return usersetDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insertSelective(Userset record){
      return usersetDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public List<Userset> selectByExample(UsersetExample example){
      return usersetDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public Userset selectByPrimaryKey(Long id){
      return usersetDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Userset record, @Param("example") UsersetExample example){
      return usersetDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExample(@Param("record") Userset record, @Param("example") UsersetExample example){
      return usersetDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKeySelective(Userset record){
      return usersetDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table userset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKey(Userset record){
      return usersetDao.updateByPrimaryKey(record);
    }

    public OnePage<Userset> selectOnePageByExample(UsersetExample example){
    	int count = usersetDao.countByExample(example);
    	List<Userset> dataList = usersetDao.selectByExample(example);
    	OnePage<Userset> onepage = new OnePage<Userset>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}